<%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Untitled Page" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<script runat="server">

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        SqlDataSource3.InsertParameters.Add("eventid", CStr(Request("eventid")))
        HyperLink2.NavigateURL = "~/Admin/AddDownload.aspx?ReturnURL=Events/Download.aspx?eventid=" & CStr(Request("eventid"))
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        SqlDataSource4.InsertParameters.Add("eventid", CStr(Request("eventid")))
        SqlDataSource4.InsertParameters.Add("downloadid", DownloadDropDown.SelectedValue.ToString)
        SqlDataSource4.Insert()
        Response.Redirect("~/Events/Download.aspx?eventid=" & Request("eventid"))
    End Sub
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<DIV id="body"><DIV class="fullwidth"><H2>Downloads for Event: <asp:Repeater id="Repeater1" runat="server" DataSourceID="SqlDataSource2">
    <ItemTemplate>
        <%#DataBinder.Eval(Container.DataItem, "[Title]")%>
    </ItemTemplate>
</asp:Repeater>&nbsp;</H2><P>
<asp:GridView id="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" DataKeyNames="id" AllowPaging="True" AutoGenerateDeleteButton="True" Width="683px" ShowHeader="False" GridLines="None">
                <EmptyDataTemplate>
                
                </EmptyDataTemplate>
                <Columns>
                    <asp:BoundField DataField="Title" SortExpression="Title" />
                    <asp:TemplateField>
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperLink1" Text="Download" runat="server" NavigateUrl='<%# Eval("URL","~/Documents/{0}") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"
                        SortExpression="id" Visible="False" />
                </Columns>
            </asp:GridView>
            </P>
            <P>
            </P>
            </DIV>
            
    <asp:ObjectDataSource ID="SqlDataSource1" runat="server" DeleteMethod="DeleteDownload"
        SelectMethod="DownloadsByEventSP" TypeName="ClubStarterKit.Web.Events">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="String" />
        </DeleteParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="EventID" QueryStringField="eventid" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    &nbsp;&nbsp;
    <asp:ObjectDataSource ID="SqlDataSource2" runat="server" SelectMethod="EventTitleByIDSP"
        TypeName="ClubStarterKit.Web.Events">
        <SelectParameters>
            <asp:QueryStringParameter Name="eventid" QueryStringField="eventid" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="SqlDataSource3" runat="server" SelectMethod="IDandTitle"
        TypeName="ClubStarterKit.Web.Events"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="SqlDataSource4" runat="server" InsertMethod="AddDownloadToEvent" TypeName="ClubStarterKit.Web.Events">
        <InsertParameters>
            <asp:Parameter Name="eventid" Type="String" />
            <asp:Parameter Name="downloadid" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
            </DIV>
<div class="fullwidth"><H2>Add Download to <asp:Label ID="eventid" runat="server" Text='<%# ClubStarterKit.Web.Events.EventTitleByIDSP(CStr(Request("eventid"))) %>'/> </H2><P><asp:DropDownList id="DownloadDropDown" runat="server" DataSourceID="SqlDataSource3" DataTextField="Title" DataValueField="id">
            </asp:DropDownList>&nbsp;</P><P><Club:RolloverButton id="Button1" onclick="Button1_Click" runat="server" Text="Add"></Club:RolloverButton>&nbsp;</P>
    <p>
        &nbsp;</p>
    <p>
        <Club:RolloverLink ID="HyperLink2" runat="server" Text="Upload" />&nbsp;</p>
</div>
</asp:Content>

